Skip to content

Conversation

@leventeBajczi
Copy link
Contributor

Old versions of z3 were really good at interpolation, and I want to add support for it in JavaSMT.

To this end, I've added the implementation of a Z3Legacy solver (to be renamed, as discussed with @baierd), which builds on the 4.5.0 release of z3, rebuilt to use com.microsoft.z3legacy as its package name to avoid name collisions with new z3.

Pre-built binaries with the modifications are available at https://github.com/leventeBajczi/z3/releases/tag/legacy-4.3.0-15644597379, which Theta already uses like this. This should be somehow integrated into the solver management of JavaSMT, which I have no experience with.

To demonstrate how good this version of Z3 is, I ran some preliminary tests in CPAchecker, and found that an NLA encoding of programs using Z3 as the interpolation solver in the predicate analysis configuration results in 510 successfully solved tasks, which are otherwise unsolved by the bitprecise encoding of the same tasks with mathsat5.

Also, I found that #381 (which I opened) is referenced in 3 of the tests, that now failed on this implementation. I removed the overly constraining line which expected the constraint IDs to be unique, which is not necessary IMO if the interpolation problem reported in that issue is otherwise handled - which it seems to be.

@baierd
Copy link
Contributor

baierd commented Oct 29, 2025

Thank you very much for the PR! It seems like the old Z3 version is beneficial to have. Could you also post the tables and/or quantile-plots from your experiments (for documentation purposes)?

We need to make sure that there are no issues when running both Z3 instances at the same time! I'll try to start some tests in CPAchecker and report back.

@leventeBajczi
Copy link
Contributor Author

Sure! Here are some:
z3-vs-baseline.table.html
In particular, the #/table?filter=0(0*status*(status(notIn()),category(in(correct)))),1(0*status*(status(notIn()),category(in(error)))) filter shows the real advantage of using Z3 with nonlinear integers complementing the best bitvector config (can solve 510 unsolved tasks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants